<%--
  @Kusal Samarakoon
--%>
<script type="text/javascript">
    function changeHectareTemp() {
        var he = 0, ac = 0, ro = 0, pe = 0, temp = 0;
        var cont = 2.47105381467;

        he = parseFloat($("#hectareId").val());
        he = he.toFixed(4);
        ac = Math.floor(he * cont);
        temp = (he * cont - ac) * 4;
        ro = Math.floor(temp);
        temp = (temp - ro) * 40;
        pe = temp.toFixed(4);
        $("#acreId").text(ac);
        $("#roodsId").text(ro);
        $("#perchesId").text(pe);

        $("#hectare").text(he);

    }
    function changeHectareKml() {
        var he = 0,ac = 0,ro = 0,pe = 0,temp = 0;
        var cont = 2.47105381467;
        he = $("#kmlArea").val() / 10000;

        if (1 > he > 0) {
            he = parseFloat(he);
        }
        ac = Math.floor(he * cont);
        temp = (he * cont - ac) * 4;
        ro = Math.floor(temp);
        temp = (temp - ro) * 40;
        pe = temp.toFixed(4);
        $("#kmlacreId").text(ac);
        $("#kmlroodsId").text(ro);
        $("#kmlperchesId").text(pe);
        $("#kmlhectareId").text(he.toFixed(4));
    }

    $(function () {
        // $('#area').hide();
        var hectare = $("#hectareId").val();
        hectare = parseFloat(hectare);
        if (hectare > 0) {
            changeHectareTemp();
        }
        //changeHectareKml();

        $('#area').hide();
        var kArea = $("#kmlArea").val()
        if (kArea > 0) {
            changeHectareKml();
        }

        /*if ($('#landMode').val() == 'DETAIL') {

         if ($('#approvalState').val() == 'DATA_ENTRY' || $('#approvalState').val() == 'PENDING') {
         var moduleType = 1;
         if ($('#approvalState').val() == 'PENDING') {
         var moduleType = 2;
         } else {
         var moduleType = 1;
         }

         calculateArea($('#landId').val(), moduleType);
         changeHectareKml();
         }

         }  */
        //changeHectareKml();

    });

    function roundNumber(number, decimals) { // Arguments: number to round, number of decimal places
        var newnumber = new Number(number + '').toFixed(parseInt(decimals));
        return parseFloat(newnumber);
    }

</script>

<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="s" uri="/struts-tags" %>

<s:if test="land.mode.ordinal() == 1">
    <tr>
        <td><s:label value="%{getText('slmsSerialNumber.label')}"/></td>
        <td colspan="3" class="left-align"><s:if test="land.id > 0"><s:property
                value="land.id"/></s:if><s:else><s:label
                value="%{getText('undefined.label')}"/></s:else></td>
    </tr>
</s:if>
<tr>
    <td><s:label value="%{getText('district.label')}"/></td>
    <td><s:property value="districtName"/></td>
    <td><s:label value="%{getText('ds_division.label')}"/></td>
    <td><s:property value="dsDivisionName"/></td>
</tr>
<tr>
    <td><s:label value="%{getText('gn_division.label')}"/></td>
    <td><s:property value="gnDivisionName"/></td>
    <td><s:label value="%{getText('local_authority.label')}"/></td>
    <td><s:property value="localAuthorityName"/></td>
</tr>
<tr>
    <td><s:label value="%{getText('village.label')}"/></td>
    <td colspan="3"><s:property value="land.village"/></td>
</tr>
<tr>
    <td><s:label value="%{getText('name_of_the_land.label')}"/></td>
    <td colspan="3"><s:property value="land.nameOfTheLand"/></td>
</tr>
<tr>
    <td><s:label value="%{getText('plan_no.label')}"/></td>
    <td><s:property value="land.planNumber"/></td>
    <td><s:label value="%{getText('lot_no.label')}"/></td>
    <td><s:property value="land.lotNumber"/></td>
</tr>
<tr id="planServeyor">
    <td><s:label value="%{getText('surveyor.label')}"/></td>
    <td><s:property value="%{getText('servey_general.label')}"/></td>
    <td><s:label value="%{getText('plan_date.label')}"/></td>
    <td><s:property value="land.planDate"/></td>
</tr>
<%--<tr>
    <td><s:label value="%{getText('parent_land_ref_number.label')}"/></td>
    <td><s:property value="land.parentLand.referenceNumber"/></td>
</tr>--%>
<%--<td><s:label value="%{getText('parent_land_ref_number.label')}"/></td>
<td>
    <s:if test="parentLandRefNumber != 0">
        <s:label name="parentLandRefNumber" onKeyPress="return numbersonly(event,true)"
                 id="parentLandRefNumber"
                 cssClass="width-200-px"/>
    </s:if>
    <s:else>
        <s:label name="parentLandRefNumber" onKeyPress="return numbersonly(event,true)"
                 id="parentLandRefNumber"
                 cssClass="width-200-px" value="%{land.parentLand.referenceNumber}"/>
    </s:else>
</td>--%>
<s:if test="land.mode.ordinal() == 1">
    <s:if test="land.geoParcelCode != null">
        <tr>
            <td><s:label value="%{getText('geoParcelCode.label')}"/></td>
            <td colspan="3"><s:label name="land.getGeoParcelCode()"
                    /></td>
        </tr>
    </s:if>
    <s:else>
        <td><s:label value="%{getText('slmsSerialNumber.label')}"/></td>
        <td colspan="3"><s:textfield id="referenceNumber" cssClass="width-200-px" name="tempRefNo"
                                     disabled="true" value="%{land.id}"/></td>
    </s:else>
</s:if>
<tr>
    <td><s:label value="%{getText('extent_of_the_land.label')}"/></td>
    <td colspan="3" class="left-align"><s:label value="%{getText('hectare.label')} :"/>
        <s:label name="hectare"/></td>
    <%--<td><s:label id="perchesId" name="hec"/></td>--%>
    <s:hidden id="hectareId" name="hectare"/>
</tr>
<tr>
    <td></td>
    <td colspan="3" class="left-align"><s:label value="%{getText('acre.label')} :"/>
        <s:label id="acreId" name="acre"/>
        &nbsp&nbsp&nbsp<s:label value="%{getText('roods.label')} :"/>
        <s:label id="roodsId" name="roods"/>
        &nbsp&nbsp&nbsp<s:label
                value="%{getText('perches.label')} :"/> <s:label id="perchesId" name="perches"/></td>

</tr>
<tr>
    <td><s:label value="%{getText('boundaries.label')}"/></td>
    <td><s:label value="%{getText('north.label')}"/></td>
    <td><s:property value="land.northBoundary"/></td>
    <td><s:property value="land.northBoundaryType.enTypeName"/></td>
</tr>
<tr>
    <td rowspan="7"></td>
    <td><s:label value="%{getText('north_east.label')}"/></td>
    <td><s:property value="land.northEastBoundary"/></td>
    <td><s:property value="land.northEastBoundaryType.enTypeName"/></td>
</tr>
<tr>
    <td><s:label value="%{getText('east.label')}"/></td>
    <td><s:property value="land.eastBoundary"/></td>
    <td><s:property value="land.eastBoundaryType.enTypeName"/></td>
</tr>
<tr>
    <td><s:label value="%{getText('south_east.label')}"/></td>
    <td><s:property value="land.southEastBoundary"/></td>
    <td><s:property value="land.southEastBoundaryType.enTypeName"/></td>
</tr>
<tr>
    <td><s:label value="%{getText('south.label')}"/></td>
    <td><s:property value="land.southBoundary"/></td>
    <td><s:property value="land.southBoundaryType.enTypeName"/></td>
</tr>
<tr>
    <td><s:label value="%{getText('south_west.label')}"/></td>
    <td><s:property value="land.southWestBoundary"/></td>
    <td><s:property value="land.southWestBoundaryType.enTypeName"/></td>
</tr>
<tr>
    <td><s:label value="%{getText('west.label')}"/></td>
    <td><s:property value="land.westBoundary"/></td>
    <td><s:property value="land.westBoundaryType.enTypeName"/></td>
</tr>
<tr>
    <td><s:label value="%{getText('north_west.label')}"/></td>
    <td><s:property value="land.northWestBoundary"/></td>
    <td><s:property value="land.northWestBoundaryType.enTypeName"/></td>
</tr>
<tr>
    <td><s:label value="%{getText('geological_type.label')}"/></td>
    <td colspan="3" class="left-align"><s:property value="geologicalType"/></td>
</tr>

<s:if test="land.mode.ordinal() == 1">

    <tr id="area">
        <td><s:label value="Area"/></td>
        <td colspan="3"><s:textfield id="kmlArea" cssClass="width-200-px" name="land.kmlLandArea" readonly="true"/></td>
    </tr>
    <tr>
        <td><s:label value="%{getText('kml_land_extent.label')}"/></td>
        <td colspan="3">
            <table class="width-100">
                <tr>
                    <td><s:label value="%{getText('hectare.label')}"/></td>
                    <td colspan="5"><s:label id="kmlhectareId" name="kmlhectare"/></td>
                </tr>
                <tr>
                    <td><s:label value="%{getText('acre.label')}"/></td>
                    <td><s:label id="kmlacreId" name="kmlacre"/></td>
                    <td><s:label value="%{getText('roods.label')}"/></td>
                    <td><s:label id="kmlroodsId" name="kmlroods"/></td>
                    <td><s:label value="%{getText('perches.label')}"/></td>
                    <td><s:label id="kmlperchesId" name="kmlperches"/></td>
                </tr>
            </table>
        </td>
    </tr>
    <s:include value="map.jsp"/>
</s:if>
<s:if test="land.landVisitComment.length() >0">
    <tr>
        <td><s:label value="%{getText('comment_about_land.label')}"/></td>
        <td colspan="3"><s:property value="land.landVisitComment"/></td>
    </tr>

</s:if>


<%--<tr id="alienation-type">
    <td><s:label value="%{getText('alienation_method.label')}"/></td>
    <td colspan="3"><s:property value="alienationTypeName"/></td>
</tr>--%>


<%--<s:include value="../documentUpload.jsp"/>--%>


<s:hidden name="land.id"/>
<s:hidden name="land.alienationState"/>
<s:hidden name="land.approvalState"/>
<s:hidden id="landMode" name="land.mode"/>
<s:hidden name="land.parentId"/>

<s:hidden id="kmlLandArea" name="land.kmlLandArea" disabled="true"/>